const Router = require('koa-router');
const seed = require('../model/seed');

const router = new Router();

router.get('/', ctx => {
    ctx.body = 'ok';
});

router.get('/api/v1/fetch', async ctx => {
    ctx.body = await seed.fetch(ctx.query);
});

router.post('/api/v1/notify', async ctx => {
    const infohashs = ctx.request.body.infohashs || [];
    const result = await seed.notify(infohashs);
    ctx.body = {success: true};
});


module.exports = router;
